﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="XiTongDic.aspx.cs" Inherits="PropertyAppraisal.SystemManage.XiTongDic" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>

        <link rel="stylesheet" type="text/css" href="../easyui/easyui/1.3.2/themes/default/easyui.css" />
    <link rel="stylesheet" type="/text/css" href="../easyui/easyui/1.3.2/themes/icon.css" />
    <%--<script type="text/javascript" src="easyui/js/jquery-1.8.0.min.js"></script>--%>
    <script src="../easyui/easyui/1.3.2/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="../easyui/easyui/1.3.2/jquery.easyui.min.js"></script>
    <script src="../easyui/easyui/1.3.2/easyloader.js"></script>
</head>
<body>
    <table id="ta" title="字典列表" style="width: 900px; height: 300px" data-options="
				rownumbers:true,
				singleSelect:true,
				autoRowHeight:false,
				pagination:true,
				pageSize:10">
            <thead>
                <tr>
                    <th field="DicId" width="200" align="center">字典编号</th>
                    <th field="DicName" width="200" align="center">字典名称</th>
                    <th field="DicType" width="200" align="center">字典类型</th>
                    <th field="cao" width="300" align="center">操作</th>
                </tr>
            </thead>
        </table>


      <script type="text/javascript">

        function addemp() {
            parent.addTab("新增员工信息", "/SystemManage/XiTongAddEmp.aspx", "", true);
        }

        //表格
        function getData() {
            var rows = [];
            $.ajax({
                type: "post", //要用post方式                 
                url: "XiTongDic.aspx/showDic",//方法所在页面和方法名
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                async: false,
                success: function (result) {
                    var json = eval("(" + result.d + ")");
                    for (var i = 0; i < json.length; i++) {
                        rows.push({
                            DicId: json[i].Dictionary_Number,
                            DicName: json[i].dictionary_Name,
                            DicType: json[i].dictionary_Type,
                            cao: '<input type="button" value="删除"/><input type="button" value="修改"/><input type="button" value="停用"/>',
                        });
                    }
                }
            })
            return rows;
        }

        function pagerFilter(data) {
            if (typeof data.length == 'number' && typeof data.splice == 'function') {	// is array
                data = {
                    total: data.length,
                    rows: data
                }
            }
            var dg = $(this);
            var opts = dg.datagrid('options');
            var pager = dg.datagrid('getPager');
            pager.pagination({
                onSelectPage: function (pageNum, pageSize) {
                    opts.pageNumber = pageNum;
                    opts.pageSize = pageSize;
                    pager.pagination('refresh', {
                        pageNumber: pageNum,
                        pageSize: pageSize
                    });
                    dg.datagrid('loadData', data);
                }
            });
            if (!data.originalRows) {
                data.originalRows = (data.rows);
            }
            var start = (opts.pageNumber - 1) * parseInt(opts.pageSize);
            var end = start + parseInt(opts.pageSize);
            data.rows = (data.originalRows.slice(start, end));
            return data;
        }

        $(function () {
            $('#ta').datagrid({ loadFilter: pagerFilter }).datagrid('loadData', getData());
        });
    </script>
</body>
</html>
